package course11;

import java.util.HashMap;
import java.util.Map;

public class Hash {
    //hash存储对象
    public static void main(String[] args) {
        //
        Map<String, Teacher> hashMap1 = new HashMap<>();
        Map<String, Teacher> hashMap2 = new HashMap<>();

        Teacher yebing = new Teacher();
        Teacher jiaoge = new Teacher();
        Teacher ff = new Teacher();

        yebing.setAge(18);
        yebing.setName("叶冰");
        hashMap1.put(yebing.getName(), yebing);

        jiaoge.setAge(28);
        jiaoge.setName("焦哥");
        hashMap1.put(jiaoge.getName(), jiaoge);

        ff.setAge(20);
        ff.setName("樊凡");
        hashMap2.put(ff.getName(), ff);

        // String str = "叶冰";

        //  System.out.println(hashMap1.get(str).getAge());

        // System.out.println(hashMap2.size());

        // hashMap的嵌套，理论上可以无限嵌套
        Map<String, Map<String, Teacher>> hashMap4 = new HashMap<>();
        hashMap4.put("pku", hashMap1);
        hashMap4.put("alibaba", hashMap2);
        System.out.println(hashMap4.get("pku").get("叶冰").getAge());

        System.out.println(hashMap4.get("alibaba").get("樊凡").getAge());
    }
}
// 刘备、关羽、张飞、花木兰，苏烈，百里守约，妲己，梦奇，裴擒虎，把这九个英雄用hashmap储存，放在同一个hashmap里面
//
//百度关键词 三国，长城小分队，妖怪
